layui.use(['form','jquery',"layer"], function(){
			  var form = layui.form;
			  var layer=layui.layer;
			  var $=layui.jquery;		  			  		  				
				// 获取id
				function getUrlParam(name) {
				        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				        var r = window.location.search.slice(1).match(reg);
				        if (r != null) return unescape(r[2]);
				        return null;
				    }
				let id = getUrlParam('id');
				$(".hidden").val(id);
				// 查询一遍数据				
				$.ajax({
					method:"GET",
					url:"/my/article/cates/"+id,	
					data:{
						"id":id
					},																	
					success:  function(resul){
						console.log(resul);
						// 数据回显
						form.val("reg",resul.data);
					}				
				});	  																						
				form.on("submit(demo6)",function(date){									
					$.ajax({
						method:"POST",
						url:"/my/article/updatecate",	
						data:date.field,																	
						success: function(result){
							// 查询里面信息成功
							console.log(result);
							layer.msg("修改成功",function(){
								parent.location.reload();
								var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
								parent.layer.close(index); //再执行关闭																					
							})					  
						}			
					});
					return false;									
				})				  
})		